import { View } from 'react-native';
import React, { useState, useEffect } from 'react';
import { Toast, WingBlank } from '@ant-design/react-native';
import List from './List';
import { selectAccReport } from '../../../../comconfig/sqlfun';

const AccReport = ({ navigation }) => {
    const [reportList, setReportList] = useState([]);
    const getReportList = async () => {
        try {
            const list = await selectAccReport();
            const arr = [];
            for (let i = 0; i < list.length; i += 1) {
                arr.push(JSON.parse(list[i]));
            }
            setReportList(arr);
        } catch (error) {
            Toast.info('获取数据失败', 1, undefined, false);
        }
    };
    useEffect(() => {
        getReportList();
    }, []);
    return (
        <View>
            <WingBlank>
                <List navigation={navigation} reportList={reportList} getList={getReportList} />
            </WingBlank>
        </View>
    );
};

export default AccReport;
